public class Solution2 {
    //双指针
    public boolean isPalindrome(int x) {
        if (x<0||x%10==0&&x!=0){
            return false;
        }

        String str=String.valueOf(x);
        int left=0;
        int right=str.length()-1;
        while (left<right){
            if (str.charAt(left)!=str.charAt(right)){
                return false;
            }
            left++;
            right--;

        }
        return true;
    }

    public static void main(String[] args) {
        Solution solution=new Solution();
        System.out.println(solution.isPalindrome(121));
        System.out.println(solution.isPalindrome(-121));
        System.out.println(solution.isPalindrome(10));

    }
}
